package com.itheima.controller;

import com.itheima.common.CommonResult;
import com.itheima.service.DishService;
import com.itheima.vo.DishListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dish")
public class DishController {

    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    public CommonResult list(String categoryId, Integer status,
                             //默认page为1
                             @RequestParam(defaultValue = "1") Integer page,
                             //默认pageSize为10
                             @RequestParam(defaultValue = "10") Integer pageSize) {
        List<DishListVo> list = dishService.getMobileList(categoryId, status, page, pageSize);
        return CommonResult.success(list);
    }


}
